package cfg

import (
	"os"
	"path"

	"gitee.com/ruige_fun/util/rlog"
)

const (
	FILEPATH         = "./files"
	LogDir           = FILEPATH + "/log"
	ConfigDir        = FILEPATH + "/config"
	UploadDir        = FILEPATH + "/upload"
	DownloadDir      = FILEPATH + "/download"
	DefaultFileModel = 0660
)

var BuildTime = ""

func init() {
	autoMkdir()
	readConfig()
	rlog.SetLogFilePath(path.Join(LogDir, "app.log"), true)
}

// autoMkdir 自动创建文件夹
func autoMkdir() {
	_ = os.MkdirAll(LogDir, DefaultFileModel)
	_ = os.MkdirAll(ConfigDir, DefaultFileModel)
	_ = os.MkdirAll(UploadDir, DefaultFileModel)
	_ = os.MkdirAll(DownloadDir, DefaultFileModel)
}
